package com.crm.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.crm.entity.Student;
import com.crm.mapper.StudentMapper;
import com.crm.service.StudentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author crm
 * @since 2020-06-05
 */
@Service//表示当前类是service层，也表示把当前类交给spring管理，ioc控制反转，需要时由spring创建对象
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements StudentService {
                            //继承了mybatis plus的接口实现，基本的增删改查方法都已经帮我们实现了
    @Resource
    private StudentMapper studentMapper;//注入mapper，因为service要调用mapper
    @Override
    public Integer updateByStuId(String[] stuId,Integer uid) {
        return studentMapper.updateByStuId(stuId,uid);
    }

    @Override
    public List<Student> exportStudent(String[] ids) {
        return studentMapper.exportStudent(ids);
    }

    @Override
    public IPage<Student> getAllStudent(Page<Student> page, Student student, @Param("uid") Integer uid, @Param("dataEntryClerk") String dataEntryClerk) {
        return studentMapper.getAllStudent(page,student,uid,dataEntryClerk);
    }

    @Override
    public IPage<Student> getStudent(Page<Student> page, Student student) {
        return studentMapper.getStudent(page,student);
    }
}
